//
//  DataModel.m
//  AsynImageDownload
//
//  Created by Santiago Fontanarrosa on 6/20/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "DataModel.h"

@implementation DataModel

@synthesize text = _text;
@synthesize imageUrl = _imageUrl;

+(DataModel*)dataModelWithDic:(NSDictionary*)dict
{
    DataModel *dm = [[DataModel alloc] init];
    
    dm.text = [dict valueForKeyPath:@"im:name.label"];
    NSArray *images = [dict valueForKeyPath:@"im:image"];
    if ([images count] > 0) {
        NSDictionary *imageDict = [images objectAtIndex:0];
        dm.imageUrl = [imageDict valueForKeyPath:@"label"];       
    }
    return dm;
}

-(void)dealloc
{
    self.text = nil;
    self.imageUrl = nil;
    [super dealloc];
}
@end
